package com.stylefeng.guns.modular.pay.controller.api;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.core.util.AjaxRes;
import com.stylefeng.guns.modular.pay.model.Message;
import com.stylefeng.guns.modular.pay.service.IMessageService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;

/**
 * 会员信息相关接口
 * @author Administrator
 *
 */
@Api(value="系统消息相关业务接口",tags="系统消息相关业务接口")
@Controller
@RequestMapping("/api/message/")
public class ApiMessageController {
	@Autowired
	private IMessageService messageService;
	
	 @RequestMapping("index")
	 public String index() {
	     return "/api/message";
	 }

	@ApiOperation(value = "系统消息", notes = "系统消息")
	@RequestMapping(value = "list", method = RequestMethod.GET)
	@ResponseBody
	public AjaxRes myinfo() {
		List<Message> list = messageService.selectList(new EntityWrapper<Message>().orderBy("create_time", false));
		return new AjaxRes(AjaxRes.SUCCESS, "查询成功",list);
	}
	
	

	@ApiOperation(value = "消息明细", notes = "消息明细")
	@ApiImplicitParam(name = "id", value = "明细id", required = true, dataType = "String",paramType="path")
	@RequestMapping(value = "detail/{id}", method = RequestMethod.GET)
	@ResponseBody
	public AjaxRes detail(@PathVariable("id")Integer id) {
		Message message = messageService.selectById(id);
		return new AjaxRes(AjaxRes.SUCCESS, "查询成功",message);
	}
	
	
	

}
